# Maintainer: Cormac Stephenson <c7s@kasku.net>
pkgname=ppl
pkgver=1.2
pkgrel=1
pkgdesc="Parma Polyhedra Library"
url="https://www.bugseng.com/ppl"
# ppc64le: fails tests
arch="all !ppc64le"
license="GPL-3.0-or-later"
subpackages="
	$pkgname-dev
	$pkgname-doc
	libppl
	libppl_c
	"
makedepends="gmp-dev m4"
source="https://bugseng.com/products/ppl/download/ftp/releases/$pkgver/ppl-$pkgver.tar.xz
	gcc13.patch
	"

prepare() {
	default_prepare
	# update config.sub to recognize loongarch64-alpine-linux-musl
	update_config_sub
}

build() {
	CFLAGS="$CFLAGS -O2" \
	CXXFLAGS="$CXXFLAGS -O2" \
	./configure \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr \
		--disable-static \
		--enable-interfaces="c,cxx"
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

libppl() {
	amove usr/lib/libppl.so.*
}

libppl_c() {
	amove usr/lib/libppl_c.so.*
}

doc() {
	default_doc
	license="GFDL-1.2-only"
}

sha512sums="
b509ed85fa6aedd40119bd4c980b17f33072c56c2acd923da3445b6bc80d48051cfa4c04cce96f6974711f5279c24b31cb3869f87b2eb6a2a1b30a058c809350  ppl-1.2.tar.xz
e9ca1b4217257c58e7a23055ffbd683ff5572112f551fedf6f81104469aedb67198c5fe03fe50f01ec9a30d737effe07e034c46282677fd824c02fb3b88c4206  gcc13.patch
"
